<?php
    /**
     *  
     */
    class UserServiceCategoryLink extends BaseModel
    {
        protected $_id;
        protected $_userId;
        protected $_serviceKey;
        protected $_serviceId;
        protected $_orderedPages;

        /**
         *  讀取資料表而產生, 請視同cache, 任何情況下皆不可更動該產生的內容
         *  @return Array()
         */
        public static function getTableDefinition()
        {
        }

        /**
         *  經資料表傳至程式中時所對應的 method 資訊
         *  @return Array()
         */
        public static function getTableFields()
        {
            return Array(
                "id"            => "getId",
                "user_id"       => "getUserId",
                "service_key"   => "getServiceKey",
                "service_id"    => "getServiceId",
                "ordered_pages" => "getOrderedPages"
            );
        }

        /**
         *  reset to default value model
         *  @return Array()
         */
        public function resetValue() {
            $this->__sleep();
            $this->setId            ( -1 );
            $this->setUserId        ( NULL );
            $this->setServiceKey    ( NULL );
            $this->setServiceId     ( NULL );
            $this->setOrderedPages  ( 100 );
        }

        /**
         *  validate model data
         *  @return messages Array()
         */
        public function validate()
        {
            $validateInfo = parent::validate();
            return $validateInfo;
        }

        /**
         *  filter model data
         */
        public function filter()
        {
            $this->setUserId        ( (int) $this->getUserId() );
            $this->setServiceKey    ( trim(strip_tags( $this->getServiceKey() )) );
            $this->setServiceId     ( (int) $this->getServiceId() );
            $this->setOrderedPages  ( (int) $this->getOrderedPages() );
        }

        /* ------------------------------------------------------------------------------------------------------------------------
            basic method 
        ------------------------------------------------------------------------------------------------------------------------ */

        /**
         *  get UserId 
         *  @return int
         */
        public function getUserId()
        {
            return $this->_userId;
        }
        /**
         *  set UserId
         */
        public function setUserId( $userId )
        {
            $this->_userId = (int) $userId;
        }

        /**
         *  get ServiceKey
         *  @return string
         */
        public function getServiceKey()
        {
            return $this->_serviceKey;
        }
        /**
         *  set ServiceKey
         */
        public function setServiceKey( $serviceKey )
        {
            $this->_serviceKey = trim($serviceKey);
        }

        /**
         *  get ServiceId 
         *  @return int
         */
        public function getServiceId()
        {
            return $this->_serviceId;
        }
        /**
         *  set ServiceId
         */
        public function setServiceId( $serviceId )
        {
            $this->_serviceId = (int) $serviceId;
        }

        /**
         *  get orderedPages id
         *  @return int
         */
        public function getOrderedPages()
        {
            return $this->_orderedPages;
        }
        /**
         *  set orderedPages id
         */
        public function setOrderedPages( $orderedPagesId )
        {
            $this->_orderedPages = (int) $orderedPagesId;
        }

        /* ------------------------------------------------------------------------------------------------------------------------
            extends
        ------------------------------------------------------------------------------------------------------------------------ */
        /**
         *  clear extends information
         */
        public function __sleep()
        {
            return parent::__sleep();
        }


    }

